home *** CD-ROM | disk | FTP | other *** search
/ CU Amiga Super CD-ROM 19 / CU Amiga Magazine's Super CD-ROM 19 (1998)(EMAP Images)(GB)[!][issue 1998-02].iso / CUCD / Utilities / Scion / ARexx / Witness.rexx < prev    next >
OS/2 REXX Batch file  |  1997-09-24  |  9KB  |  177 lines

  1. /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
  2. /*         Extraction of "Witness" data for Ted Wildy's index             */
  3. /*         ==================================================             */
  4. /*                       script Witness.rexx                              */
  5. /*                                                                        */
  6. /* Ted Wildy (NZ) is accumulating UK marriages, indexed on WITNESSES.     */
  7. /* This seems to me to be an excellent idea, to which as many of us as    */
  8. /* possible should contribute.                                            */
  9. /* This script reads your Scion Family records and tries to construct     */
  10. /* records for inclusion in the Index, writing its output to the file     */
  11. /* RAM:Witnesses, where you can edit it as required before submission.    */
  12. /* Of course, the Scion database must be running for the script to work.  */
  13. /*                                                                        */
  14. /* The format of a single four-line file record in the existing files     */
  15. /* (which this script tries to reproduce) is:                             */
  16. /*                                                                        */
  17. /*  Witness-Forenames   Witness-SURNAME     date        Church            */
  18. /*  Husband-Forenames   Husband-SURNAME     Town                 XXX      */
  19. /*  Wife----Forenames   Wife----SURNAME     your-FHS/member-number        */
  20. /*     your full name and address (for contact)                           */
  21. /*                                                                        */
  22. /*  where XXX represents the UK County code.                              */
  23. /*                                                                        */
  24. /* Note that one marriage may have several witnesses: the script must     */
  25. /* convert the marriage into several records, one per witness.            */
  26. /*                                                                        */
  27. /* Your Family History Society name and membership number are included    */
  28. /* for contact in case you change your address. If you do not belong to   */
  29. /* a Society they should be left blank.                                   */
  30. /*                                                                        */
  31. /* As supplied, the script expects the witnesses in Scion's Witness field */
  32. /* to be separated by commas or semicolons -- it uses TRANSLATE to change */
  33. /* semis to commas before splitting the field up. You can, of course,     */
  34. /* make any alterations you want, but fullstops are not good separators,  */
  35. /* as they may be used with initials within witness-names.                */ 
  36. /*                                                                        */
  37. /* Since you may wish to run the script more than once as you build up    */
  38. /* your database, and since it is best not to send several copies of the  */
  39. /* same witnesses to the index, I have arranged that if the first char in */
  40. /* the Scion Witness field is an asterisk (*) that wedding is ignored.    */
  41. /* If anyone wants the _script_ to insert the asterisk, let me know.      */
  42. /*                                                                        */
  43. /* There are, unfortunately, some insuperable problems requiring user     */
  44. /* intervention -- this means YOU :-)                                     */
  45. /*                                                                        */
  46. /* 1. Since the Scion "Wedding Place" field is free-form, I can't extract */
  47. /*    the separate "Church" and "Town" info required. The best I can do   */
  48. /*    is to insert the "Wedding Place" field (or most of it) in BOTH      */
  49. /*    positions, leaving you to edit the results later.                   */
  50. /*    If the "Wedding Place" field is empty, I force "Parish Church?"     */
  51. /*    into the "Church" info area.                                        */
  52. /* 2. Without a complete built-in gazetteer of UK, I cannot automate the  */
  53. /*    "County" code. I've done what I can, as you will see if/when you    */
  54. /*    run the script, but once per marriage it may be a bit irritating.   */
  55. /* 3. There's a potential problem with the marriage date. It's probably   */
  56. /*    fair to assume that if you know the witnesses you also know the     */
  57. /*    exact date, but the Index wants it in fixed form, ie DDMMMYYYY: no  */
  58. /*    spaces, and a non-significant zero, whereas Scion is less fussy.    */
  59. /*    This script assumes that you've used the format D(D) MMM YYYY, and  */
  60. /*    tries to convert it on that basis, but if your format is different  */
  61. /*    there may be trouble :-(      Sorry, but that's life. You are, of   */
  62. /*    course, welcome to change the script to suit your own format.       */
  63. /*                                                                        */
  64. /*       Any queries, you can email me at dave@beames.demon.co.uk         */
  65. /*________________________________________________________________________*/
  66.  
  67. OPTIONS RESULTS
  68. OPTIONS PROMPT ">>> "
  69. MyPort="SCIONGEN"
  70. ADDRESS VALUE MyPort
  71.  
  72. /*output = 'STDOUT'*/
  73.  
  74. filename = "RAM:WitnessList"   /* change it if you want */
  75. OPEN(w_file, filename, "w")
  76. output = w_file
  77.  
  78. sep = ','                      /* default to "comma" witness separator */
  79.         
  80. county = "LND"                 /* start by defaulting to "London" */
  81. gettotalfgrn
  82. total = result
  83.  
  84. WRITELN(stdout, "Please type your NAME and ADDRESS and press <RET>")
  85. PARSE PULL myname
  86. myname = "   "myname
  87. WRITELN(stdout, "")
  88. WRITELN(stdout, "Please type your FHS-name/membership-number if any, and press <RET>")
  89. PARSE PULL mysoc
  90.  
  91. DO x = 1 to total
  92.         getwitness x
  93.         IF result == "" THEN ITERATE     /* Ignore marriage if no witnesses */
  94.         IF LEFT(result,1) == "*" THEN ITERATE  /* or if prev listed */
  95.         witnesses = result
  96.                 
  97.         /* Get fixed data for this marriage */
  98.                 
  99.         getprincipal x
  100.         p = result
  101.         getspouse x
  102.         s = result      
  103.         getsex s
  104.         IF result = "M" THEN
  105.         DO
  106.                 t = s           /* Put male partner first (sorry, ladies) */
  107.                 s = p
  108.                 p = t
  109.         END
  110.         principal = MakeName(p) 
  111.         spouse    = MakeName(s)
  112.                 
  113.         /* Validate date field, & compress if standard */
  114.                 
  115.         getmarrydate x
  116.         marrydate = result
  117.         PARSE VAR marrydate mday mmonth myear rest
  118.         lday = LENGTH(STRIP(mday))
  119.         IF   lday < 3 & DATATYPE(mday, N) & mday < 32,
  120.            & LENGTH(STRIP(mmonth)) == 3 & DATATYPE(mmonth, M),
  121.            & LENGTH(STRIP(myear)) == 4 & DATATYPE(myear, N),
  122.            & rest == "" THEN
  123.                 DO
  124.                 IF lday == 1 THEN marrydate = "0"marrydate
  125.                 marrydate = COMPRESS(marrydate)
  126.                 END
  127.                 
  128.         /* Sort out "Church", "Place" & "County" as far as poss */
  129.                 
  130.         getmarryplace x
  131.         church = result
  132.         place = ""
  133.         IF church = "" THEN church = "Parish Church?"
  134.         ELSE DO
  135.                 place = RIGHT(church, 19)
  136.                 place = LEFT(STRIP(place), 20)
  137.                         
  138.                 WRITELN(stdout, "This marriage took place at " church)
  139.                 WRITELN(stdout, "Please type 3-letter county code -- default " county)
  140.                 PULL newcounty
  141.                 IF newcounty ~= "" THEN county = newcounty
  142.         END
  143.  
  144.         /* Get variable data (ie witnesses) for this marriage */
  145.         /* & output n Witness Records */
  146.         
  147.         witnesses = TRANSLATE(witnesses, sep, ';')        
  148.         DO while witnesses ~= ""
  149.                 PARSE var witnesses witname (sep) witnesses
  150.                 fname = " "
  151.                 DO forever
  152.                         PARSE var witname namea witname
  153.                         lname = namea
  154.                         IF witname == "" THEN LEAVE
  155.                         fname = fname namea
  156.                 END
  157.                         
  158.                 WRITECH(output, LEFT(STRIP(fname),19) LEFT(UPPER(STRIP(lname)),20))
  159.                 WRITELN(output, LEFT(marrydate, 11) LEFT(church, 24))
  160.                 WRITELN(output, principal place county)
  161.                 WRITELN(output, spouse mysoc)
  162.                 WRITELN(output, myname)
  163.                 WRITELN(output, "")
  164.                 
  165.         END
  166. END
  167.  
  168. EXIT
  169.  
  170. MakeName:            /* Thanx to Peter Billing :) */
  171. PARSE ARG irn
  172. getfirstname irn
  173. name = LEFT(result,19)
  174. getlastname irn
  175. name = name LEFT(result,19)
  176. RETURN name
  177.